package com.itheima.d04_map_hashmap;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

@Data  //Getter+Setter+ToString+equals+hashCode
@NoArgsConstructor
@AllArgsConstructor
public class Student implements Comparable<Student> {
    private String name;
    private int age;
    private String sex;

    @Override
    public int compareTo(Student o) {
        if( this.age==o.age){
            if(this.name.equals(o.name)){
                return this.sex.compareTo(o.sex);
            }else{
                return this.name.compareTo(o.name);
            }
        }

        return this.age-o.age;
    }
}
